@extends('layout.master')

@section('title','商户列表')

@section('css')
    @parent
    <!-- Daterange picker plugins css -->
    <link href="{{ asset('plugins/bower_components/bootstrap-daterangepicker/daterangepicker.css') }}" rel="stylesheet">
    <style>
        .floating-labels .radioInput label {
            position: static;
        }

    </style>
@endsection
@section('main')

    <div class="panel">
        <div class="panel-wrapper collapse in" aria-expanded="true">
            <div class="panel-body">
                <form action="#">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-3 col-sm-6">
                                <div class="form-group">
                                    <label class="control-label">商铺名称</label>
                                    <input type="text" class="column_filter form-control"
                                           data-column="0"
                                           placeholder="商铺名称">
                                </div>
                            </div>
                            <div class="col-xs-3 col-md-3">
                                <div class="form-group">
                                    <label for="status">状态</label>
                                    <select class="form-control column_filter"
                                            data-column="1">
                                        <option value="a">全部</option>
                                        @foreach(App\Shop::$StatusDisplay as $key => $value)
                                            <option value="{{ $key }}">{{ $value }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div class="white-box">
            <div class="table-responsive">
                <table id="example23"
                       class="display nowrap table table-striped table-bordered table-hover order-column my-table "
                       cellspacing="0" width="100%" data-url="{{ url(request()->getUri()) }}">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>商户名称</th>
                        <th>审核状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
@endsection

@section('js')
    @parent
    <script>
        //删除
        obj.on('click', '.btn-del', function () {
            var id = $(this).data('id');
            var _this = $(this);
            swal({
                    title: "",
                    text: "确定删除么？",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "是的",
                    closeOnConfirm: false
                },
                function () {
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        },
                        url: '/shop/del/' + id,
                        type: 'POST',
                        success: function (data) {
                            if (data.status !== 1) {
                                swal(data.message);
                            } else {
                                swal(data.message, '', 'success');
                                $('.confirm').click(function () {
                                    _this.parent().parent().text('');
                                });
                            }
                        }
                    })
                }
            );
        });

    </script>
@endsection